//
//  EditReportTraView.m
//  LoveTrail
//
//  Created by giantumbrella on 15/6/27.
//  Copyright (c) 2015年 赵娟. All rights reserved.
//

#import "EditReportTraView.h"
#import "CommonMacro.h"

@interface EditReportTraView ()

@property (nonatomic,strong) UILabel *descriptionLabel;
@property (nonatomic,strong) UIView *topView;
@property (nonatomic,strong) UILabel *buttomTextLabel;
@property (nonatomic,strong) UITextField *titleTextField;
@property (nonatomic,strong) UIButton *addImgButton;
@property (nonatomic,strong) UILabel *textNumLabel;
@end
@implementation EditReportTraView

- (id)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self createSubview];
        self.layer.borderColor = UIColorWithRGBA(210, 210, 210, 1).CGColor;
        self.layer.borderWidth = 1.2;
        self.layer.cornerRadius = 3;
        self.clipsToBounds = YES;
    }
    return self;
}

- (void)createSubview
{

    //2.头部块
    self.topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height*0.4)];
    [self addSubview:self.topView];
//    self.topView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"报告框"]];
    self.topView.backgroundColor = [UIColor redColor];
   //填写试用报告
    self.descriptionLabel = [[UILabel alloc] initWithFrame:CGRectMake(6, 2, self.frame.size.width*0.3, self.frame.size.height*0.08)];
    [self.topView addSubview:self.descriptionLabel];
    self.descriptionLabel.text = @"填写试用报告";
    self.descriptionLabel.font = [UIFont boldSystemFontOfSize:15];
    self.descriptionLabel.textColor = UIColorWithRGBA(255, 255, 255, 1);
    
     //3.标题
    self.titleTextField = [[UITextField alloc] initWithFrame:CGRectMake(self.descriptionLabel.frame.size.width+self.descriptionLabel.frame.origin.x-20, self.descriptionLabel.frame.size.height+self.descriptionLabel.frame.origin.y+10, self.frame.size.width*0.6, 30)];
    self.titleTextField.placeholder = @"标题";
    self.titleTextField.layer.cornerRadius = 3;
    self.titleTextField.clipsToBounds = YES;
    [self.topView addSubview:self.titleTextField];
    self.titleTextField.textColor = UIColorWithRGBA(176, 176, 176, 1);
    self.titleTextField.backgroundColor = [UIColor whiteColor];
    
     //4.添加照片
    self.addImgButton = [[UIButton alloc] initWithFrame:CGRectMake(self.descriptionLabel.frame.origin.x+3, self.topView.frame.size.height*(1-0.3), self.topView.frame.size.width*0.24, self.topView.frame.size.height*0.23)];
    [self addSubview:self.addImgButton];
    [self.addImgButton setTitle:@"添加照片" forState:UIControlStateNormal];
    [self.addImgButton.titleLabel setFont:[UIFont boldSystemFontOfSize:15]];
    [self.addImgButton setTitleColor:UIColorWithRGBA(254, 243, 245, 1) forState:UIControlStateNormal];
    [self.addImgButton setBackgroundImage:[UIImage imageNamed:@"提交按钮"] forState:UIControlStateNormal];
    self.addImgButton.layer.cornerRadius = 3;
    self.addImgButton.clipsToBounds = YES;
    
    //5.正文字数
    self.textNumLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.topView.frame.size.width*0.6, self.addImgButton.frame.origin.y, self.frame.size.width*0.39, self.addImgButton.frame.size.height)];
    [self addSubview:self.textNumLabel];
    self.textNumLabel.text = @"203/100字";
    self.textNumLabel.textColor = UIColorWithRGBA(175, 174, 174, 1);
    self.textNumLabel.font = [UIFont boldSystemFontOfSize:15];
    self.textNumLabel.textAlignment = NSTextAlignmentRight;
    //6.底部 正文
    self.buttomTextLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.topView.frame.size.height, self.frame.size.width, self.frame.size.height-self.topView.frame.size.height)];
    [self addSubview:self.buttomTextLabel];
    self.buttomTextLabel.text = @"The story that some time ago,a man punished his 3-year-old ddaughter for wasting a roll of gold wrapping paper.Money was tigth and he became infuriated when the child tried to decorate a box to put under the Christmas tree. Nevertheless,the littile girl brought the gift to her father the next morning and said,This is for you,DaddyThe story goes that some time ago,a man punished his 3-year-old daughter for wasting a roll of gold wrapping paper.Money was tight and he become infuriated when the child tried to decorate a ";
    self.buttomTextLabel.numberOfLines = 0;
    self.buttomTextLabel.textAlignment = NSTextAlignmentLeft;
    self.buttomTextLabel.textColor = UIColorWithRGBA(175, 175, 175, 1);
    self.buttomTextLabel.font = [UIFont systemFontOfSize:12];
    [self.buttomTextLabel sizeToFit];
}
@end
